package com.zd.commodity.productMng.dao.impl;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.zd.commodity.dao.impl.BaseDao;
import com.zd.commodity.productMng.dao.IProductAttrGroupDao;
import com.zd.commodity.productMng.entity.ProductAttrGroup;
import com.zd.commodity.productMng.entity.ProductAttrValue;
@Repository
public class ProductAttrGroupDao extends BaseDao<ProductAttrGroup> implements
		IProductAttrGroupDao {

	@Resource(name = "sessionFactory")
	public void setSuperSessionFactory(SessionFactory sessionFactory){
		super.setSessionFactory(sessionFactory);
	}
	
	@Override
	public DetachedCriteria getDetachedCriteria(ProductAttrGroup t1,
			ProductAttrGroup t2, Object param) {
		DetachedCriteria dc=DetachedCriteria.forClass(ProductAttrGroup.class);
		if(t1!=null&&t1.getCategoryId()!=null){
			dc.add(Restrictions.eq("categoryId", t1.getCategoryId()));
		}
		return dc;
	}

}
